<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::group(['namespace' => 'API'], function() {
    Route::get('index', 'IndexController@index');
});

Route::group(['namespace' => 'API'], function() {
    Route::any('wechat', 'WechatController@index');
});

// 小程序接口路由
Route::group(['namespace' => 'API'], function() {
    // 文章接口
    Route::get('article_list/{pagination?}', 'WechatAppController@article_list'); //获取文章列表
    Route::get('article_detail/{id}', 'WechatAppController@article_detail'); //获取文章详情
    Route::get('article_search/{keyword}', 'WechatAppController@article_search'); //获取文章搜索结果
    Route::get('article_category', 'WechatAppController@article_category'); //获取文章分类
    Route::get('article_category_list/{id}/{pagination?}', 'WechatAppController@article_category_list'); //获取分类文章列表

    // 产品接口
    Route::get('product_list/{pagination?}', 'WechatAppController@product_list'); //获取产品列表
    Route::get('product_detail/{id}', 'WechatAppController@product_detail'); //获取产品详情
    Route::get('product_search/{keyword}', 'WechatAppController@product_search'); //获取产品搜索结果
    Route::get('product_category', 'WechatAppController@product_category'); //获取产品分类
    Route::get('product_category_list/{id}/{pagination}', 'WechatAppController@product_category_list'); //获取分类产品列表

    // 广告接口
    Route::get('ad', 'WechatAppController@ad'); //获取广告列表
    Route::get('ad_detail/{id}', 'WechatAppController@ad_detail'); //获取广告详情
    Route::get('ad_category', 'WechatAppController@ad_category'); //获取广告分类
    Route::get('ad_category_list/{id}', 'WechatAppController@ad_category_list'); //获取广告产品列表

    // 关于我们接口
    Route::get('about_list', 'WechatAppController@about'); //获取关于我们列表
    Route::get('about_detail/{id}', 'WechatAppController@about'); //获取文章详情

    // 留言反馈接口
    Route::get('feedback','WechatAppController@feedback'); //获取留言反馈列表
    Route::get('feedback/{id}','WechatAppController@feedback'); //获取单条留言反馈
    Route::post('feedback_p','WechatAppController@feedback_p'); //接受留言反馈

    // 用户接口
    Route::get('user/{id}','UsersController@get_user'); //获取用户信息
    Route::get('user_fb/{id}','UsersController@user_fb'); //获取用户留言

});